package com.atguigu.gmall.order.biz;

import com.atguigu.gmall.enums.OrderStatus;
import com.atguigu.gmall.enums.ProcessStatus;
import com.atguigu.gmall.order.vo.OrderConfirmVo;
import com.atguigu.gmall.order.vo.OrderSubmitVo;

/**
 * @author:ahang
 * @create:2022-10-23 1:58
 * @Description:
 */
public interface OrderBizService {
    /**
     * 获取订单确认数据
     *
     * @return
     */
    OrderConfirmVo getOrderConfirmdata();

    /**
     * 提交订单数据
     *
     * @param orderSubmitVo
     * @param tradeNo
     * @return
     */
    Long submitOrder(OrderSubmitVo orderSubmitVo, String tradeNo);

    /**
     * 根据校验通过的合法数据,保存订单
     *
     * @param orderSubmitVo
     * @param tradeNo
     * @return
     */
    Long saveOrder(OrderSubmitVo orderSubmitVo, String tradeNo);

    /**
     * 关闭订单
     *
     * @param orderId
     * @param userId
     */
    void closeOrder(Long orderId, Long userId);

    /**
     * 利用cas机制实现关单操作
     *
     * @param orderId
     * @param userId
     */
    void changeOrderStatusByCAS(OrderStatus expectOrderStatus,
                                ProcessStatus expectProcessStatus,
                                OrderStatus orderStatus,
                                ProcessStatus processStatus,
                                Long orderId,
                                Long userId);
}
